package com.nineclock.approve.activiti.impl;

import cn.hutool.json.JSONObject;
import com.nineclock.approve.activiti.ProcessNodeResolver;
import org.activiti.bpmn.model.Process;
import org.activiti.bpmn.model.UserTask;

/**
 * 审批节点解析处理器
 */
public class ApproveNodeResolver extends ProcessNodeResolver {

    @Override
    public void addFlowNodeToActiviti(Process process, JSONObject currNode, JSONObject nextNode) {

        //创建任务节点
        UserTask userTask = new UserTask();
        userTask.setId(getNodeId(currNode));
        userTask.setName(currNode.getStr("name"));
        userTask.setCategory("1");//审批

        
        process.addFlowElement(userTask);
        newSequenceFlow(process, currNode, nextNode);
    }
}